package com.xiaojian.pick.controller;

import com.xiaojian.pick.entity.BondHistory;
import com.xiaojian.pick.page.AjaxResult;
import com.xiaojian.pick.service.BondHistoryService;
import com.xiaojian.pick.vo.HistoryVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author whycode
 * @title: BondHistoryController
 * @projectName campus-secondary-market-app---sys
 * @description: TODO
 * @date 2022/3/1316:35
 */

@RestController
@RequestMapping("/history")
public class BondHistoryController {

    @Resource
    private BondHistoryService historyService;

    @PutMapping("/import")
    public boolean importExcel(){
        historyService.importFromExcel();
        return true;
    }


    @GetMapping("/queryByPage")
    public AjaxResult queryByPage(Integer page, Integer limit){

        List<HistoryVO> mapList = this.historyService.listByPage(page, limit);

        return new AjaxResult(true).setData(mapList);
    }

}
